import java.util.*;

class Main {

    public static void main1(String[] args) {

        Scanner scanner = new Scanner(System.in);
        // 国赛我准备使用java去写

        // 接收变量
        long n = scanner.nextLong();
        // 创建answer变量，用于存储最终结果
        long answer = 0;
        long MOD = 3333;

        // 枚举三个数均不相同的情况 默认 a < b < c
        for(long a = 1; a*a*a < n; a++) {
            for(long b = a+1; a*b*b < n; b++) {
                long c = n / (a*b) - b;
                if(c > 0) {
                    answer += (c * 6);
                }
                answer %= MOD;
            }
        }

        // 枚举两大一小的情况,枚举较小的数
        for(long a = 1; a*a*a < n; a++) {
            long b = (long)(Math.sqrt(n / a) - a);
            if(b > 0) {
                answer += (b * 3);
            }
            answer %= MOD;
        }

        // 枚举两小一大的情况，枚举较小的数
        for(long a = 1; a*a*a < n; a++) {
            long b = n / (a*a) - a;
            if(b > 0) {
                answer += (b * 3);
            }
            answer %= MOD;
        }

        // 枚举三个数相同的情况
        for(long a = 1; a*a*a <= n; a++) {
            answer++;
        }

        System.out.println(answer%MOD);

        scanner.close();
    }


    public static void main(String[] args) {

    }
}

class Solution {
    public int incremovableSubarrayCount(int[] nums) {
        int n = nums.length;

        // 1 创建两个数组 f数组表示以当前下标元素为结尾的最长递增子数组 g数组表示以当前下标为结尾的最长递减子数组
        int[] f = new int[n];
        int[] g = new int[n];
        // 先将数组中元素都初始化为最差情况
        Arrays.fill(f, 1);
        Arrays.fill(g, 1);
        // 开始填写数组
        //(1) 填写严格递增
        for(int i = 1; i < n; i++) {
            if(nums[i] > nums[i-1])
                f[i] += f[i-1];
        }
        //（2） 填写严格递减
        for(int j = n-2; j >= 0; j--) {
            if(nums[j] < nums[j+1])
                g[j] += g[j+1];
        }
        // 2 使用固定窗口双指针进行枚举子数组
        int answer = 0;
        for(int interval = 0; interval < n; interval++) {
            int left = 0, right = left + interval;
            while(right < n) {
                if((left == 0 && right == n-1)
                        || (right != n-1 && left == 0 && g[right+1] == n-right-1)
                        || (left != 0 && right == n-1 && f[left-1] == left)
                        || (left != 0 && right != n-1 && g[right+1] == n-right-1 && f[left-1] == left && nums[left-1] < nums[right+1])) {
                    answer++;
                }
                left += 1;
                right += 1;
            }
        }
        return answer;
    }

    public static void main(String[] args) {
        Solution test = new Solution();
        System.out.println(test.incremovableSubarrayCount(new int[]{8, 7, 6, 6}));
    }



    public void func(List<Integer> A, List<Integer> B, List<Integer> C, int n) {
        if (n == 1) {
            C.add(A.remove(0));
            return;
        }
        // 将A柱子上前n-1个盘子借助C挪到B
        func(A, C, B, n-1);
        // 将A柱子的最后一个盘子放到C
        C.add(A.remove(0));
        // 将B柱子上的盘子借助A挪到C
        func(B, A, C, n-1);
        return;
    }

    public void hanota(List<Integer> A, List<Integer> B, List<Integer> C) {
        int n = A.size();
        func(A, B, C, n);
    }
}

